package com.test.basic;

public class SuperEggDemo {
    public static void main(String[] args) {
//        System.out.println(Math.pow(2,3));
//        System.out.println(Math.ceil(0.1));
//        System.out.println(log(7,2));

        System.out.println(superEggDrop(2,6));
    }

    public static int superEggDrop(int k, int n) {
        int d = (int)Math.ceil( log(n+0.0,2.0)) ;
        if(k > d && d!=0){
            return d + 1;
        }
       return (int)Math.ceil(n/(Math.pow(2,k-1))) ;
    }

    //换底公式
    private static double log(double value,double base){
        return Math.log(value)/Math.log(base);
    }

}
